package com.toro.server.handler;

import com.toro.message.GroupChatRequestMessage;
import com.toro.message.GroupChatResponseMessage;
import com.toro.dao.GroupSessionFactory;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.util.List;

/**
 * @ClassName: GroupChatResponseMessageHandler
 * @Description:
 * @Author: ToroLHZ
 * @Date: 2023/12/11 17:46
 */
@ChannelHandler.Sharable
public class GroupChatResponseMessageHandler extends SimpleChannelInboundHandler<GroupChatRequestMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, GroupChatRequestMessage groupChatRequestMessage) throws Exception {
//        List<Channel> channels = GroupSessionFactory.getGroupSession().getMembersChannel(groupChatRequestMessage.getGroupName());
//        for (Channel channel : channels) {
//            GroupChatResponseMessage groupChatResponseMessage = new GroupChatResponseMessage(groupChatRequestMessage.getFrom(), groupChatRequestMessage.getContent());
//            groupChatResponseMessage.setSuccess(true);
//            channel.writeAndFlush(groupChatResponseMessage);
//        }
    }
}
